var request = new 	XMLHttpRequest()
var url = 'http://res.abeim.cn/api-history_today'
var ul = document.querySelector('#thing')
request.open('GET', url, true)

console.log('开始调用远程API服务...')

request.onload = function () {
	var data = JSON.parse(this.response)
	
	var status = request.status
	if (status >= 200 && status < 400) {
		var arr = data.data
		arr.forEach(myFunction)
	} else {
		console.log("error!")
	}
}

function myFunction(value, index) {
	var li = document.createElement('li')
	// 随机颜色代码🚬
	// var r = Math.floor(Math.random()*256)
	// var g = Math.floor(Math.random()*256)
	// var b = Math.floor(Math.random()*256)
	// li.style.color = '#' + r.toString(16) + g.toString(16) + b.toString(16)
	li.innerHTML = value.time + " : " + value.data
	ul.appendChild(li)
}

request.send()